<template>
    <el-container>
        <el-main class="wrapper">
            <section class="panel cms-content">
                <div class="panel-body">
                    <div class="cms-btn-group">
                        <el-button type="success" icon="fa fa-refresh" @click="list()" size="small"> 刷新</el-button>
                    </div>
<!--                    <div class="cms-search-group">-->
<!--                        <div class="cms-search-item">-->
<!--                            <el-input  size="medium" v-model="params.kwd" placeholder="请输入账号或者联系方式" class="input-with-select">-->
<!--                                <el-button type="primary" @click="search()" slot="append" icon="el-icon-search"></el-button>-->
<!--                            </el-input>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <el-table ref="multipleHandle"-->
<!--                              v-loading="loading"-->
<!--                              element-loading-text="努力加载中..."-->
<!--                              element-loading-spinner="el-icon-loading"-->
<!--                              tooltip-effect="dark" :data="listData.data"  border>-->
<!--                        <el-table-column prop="created_at" label="日期" width="180"></el-table-column>-->
<!--                        <el-table-column align="center" prop="order_id" label="编号" width="100"></el-table-column>-->
<!--                        <el-table-column prop="user_plain_name" label="姓名" width="150"></el-table-column>-->
<!--                        <el-table-column prop="user_plain_mobile" label="联系方式" width="120"></el-table-column>-->
<!--                        <el-table-column prop="user_plain_address" label="详细地址" :show-overflow-tooltip="true" width="180"></el-table-column>-->
<!--                        <el-table-column align="center" prop="status_text" label="状态" width="75">-->
<!--                            <template slot-scope="scope">-->
<!--                                <span v-html="scope.row.status_text"></span>-->
<!--                            </template>-->
<!--                        </el-table-column>-->
<!--                        <el-table-column prop="cate_id" label="维修类别" width="80"></el-table-column>-->
<!--                        <el-table-column prop="repair_at" label="维修时间" width="180"></el-table-column>-->
<!--                        <el-table-column label="操作" >-->
<!--                            <template slot-scope="scope">-->
<!--                                &lt;!&ndash;<el-button @click="edit(scope.row)" icon="fa fa-edit" type="primary" size="mini" plain> 编辑</el-button>&ndash;&gt;-->
<!--                                <el-button @click="destory(scope.row.id)" icon="fa fa-trash" type="danger" size="mini" plain> 删除</el-button>-->
<!--                            </template>-->
<!--                        </el-table-column>-->
<!--                    </el-table>-->
<!--                    <pagination :pageData="listData" :params="params" @list="list"/>-->
                </div>
            </section>
        </el-main>
    </el-container>
</template>

<script>
    import {mapGetters} from 'vuex';
    import {OrderList,OrderDestroy} from '@/utils/request';
    import Pagination from '@/components/pagination';
    export default {
        components: {Pagination},
        data() {
            return {
                listData: [],//列表数据
                params: {page:1,kwd:''},
                dialog: {
                    title: '',
                    top: '10vh',
                    show: false,
                    width: '500px'
                },
            }
        },
        activated(){
            // this.list();
        },
        computed: {
            ...mapGetters(['active','loading']),
        },
        methods: {
            //筛选
            search(){
                this.params.page = 1;
                this.list();
            },
            //列表
            list(){
                this.$store.dispatch('setLoading', true);
                OrderList({params: this.params}).then((res)=>{
                    if (res.code) {
                        this.$message.error(res.msg);
                    } else {
                        this.listData = res.data;
                    }
                    this.$store.dispatch('setLoading', false);
                })
            },
            //删除
            destory(id){
                this.$confirm('确定要删除该订单信息吗？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    OrderDestroy({id: id}).then((res) => {
                        if (res.code) {
                            this.$message.error(res.msg);
                        } else {
                            this.list();
                        }
                    });
                }).catch(() => {});
            },
        }
    }
</script>

<style scoped>

</style>
